package com.teaphy.coroutinecrawler.flow.operators.transform

import kotlinx.coroutines.*
import kotlinx.coroutines.flow.*

fun main() = runBlocking {
    flow {
        emit(1)
        delay(150)
        emit(2)
        delay(150)
        emit(3)
    }.transformLatest { ele ->
        repeat(ele) {
            delay(100)
            emit(ele)
        }
    }.collect {
        println("receive: $it")
    }

    println("Done")
}